<template>
  <van-tabbar route active-color="#f00" inactive-color="#000">
    <van-tabbar-item replace to="/" icon="wap-home-o">首页</van-tabbar-item>
    <van-tabbar-item replace to="/category" icon="search">分类</van-tabbar-item>
    <van-tabbar-item
      v-if="$store.getters.getBadgeCount > 0"
      replace
      to="/shopcart"
      icon="shopping-cart-o"
      :badge="$store.getters.getBadgeCount"
      >购物车</van-tabbar-item
    >
    <van-tabbar-item v-else replace to="/shopcart" icon="shopping-cart-o"
      >购物车</van-tabbar-item
    >

    <van-tabbar-item replace to="/user" icon="user-o">我的</van-tabbar-item>
  </van-tabbar>
</template>

<script>
export default {
  props: {
    active: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      select: 0,
      badgeCount: this.$store.badgeCount,
    };
  },
};
</script>